{% extends 'blogobj/layout.html' %}
{% block styles %}

{% endblock %}

{% block blog_header %}
    <section class="all_page_slider_bg">
        <div class="container">
            <div class="row">
                <div class="col-xs-12">
                    <div class="normal_service_text all_page_slider_text">
                        <h2>博客管理</h2>
                        <ol class="breadcrumb">
                            <li><a href="{{ url_for('.blog_index') }}">首页</a><span></span></li>
                            <li class="active"><a href="#">发布博客</a></li>
                        </ol>
                    </div>
                </div><!-- column End -->
            </div><!-- row End -->
        </div><!-- container End -->
    </section>
{% endblock %}

{% block main_content %}
    <section class="contact_area section_padding_top col-lg-8">
        <div class="container">
            <div class="row">
                <div class="col-xs-12 col-lg-5 col-lg-offset-2">
                    <div class="section_title ">
                        <h2>发布博客<span><i class="fa fa-pencil-square"></i></span></h2>

                    </div>
                </div><!-- column end -->
            </div><!-- row end -->
            <div class="row">
                <div class="col-md-offset-1 col-sm-8 col-md-8">
                    <form action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
                        <div class="form-group">
                            {{ form.title.label(class="col-md-2 control-label") }}
                            <div class="col-sm-8 col-md-5">
                                {{ form.title(class="form-control ") }}
                            </div>
                        </div>
                        <div class="form-group">
                            {{ form.categoryid.label(class="col-md-2 control-label") }}
                            <div class="col-sm-8 col-md-3">
                                {{ form.categoryid(class="form-control ") }}
                            </div>
                        </div>
                        <div class="form-group">
                            {{ form.author.label(class="col-md-2 control-label") }}
                            <div class="col-sm-8 col-md-3">
                                {{ form.author(class="form-control ") }}
                            </div>
                        </div>
                        <div class="form-group">
                            {{ form.preface.label(class="col-md-2 control-label") }}
                            <div class="col-sm-8 col-md-3">
                                {{ form.preface(class="form-control ") }}
                            </div>
                        </div>
                        <div class="form-group">
                            {{ form.faceimage.label(class="col-md-2 control-label") }}
                            <div class="col-sm-8 col-md-3">
                                {{ form.faceimage }}
                            </div>
                        </div>
                        <div class="form-group">
                            {{ form.body.label(class="col-md-2 control-label") }}
                            <div class="col-sm-8 col-md-10">
                                {{ form.body( id="ueditor") }}
                                {#                                <script id="container" name="content" type="text/plain">输入内容</script>#}
                            </div>
                        </div>
                        <div class="form-group">
                            {{ form.isshow.label(class="col-md-2 control-label") }}
                            <div class="col-md-2">
                                {{ form.isshow }}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 col-sm-2 control-label"></label>
                            <div class="col-lg-10">
                                <button type="submit" id="btnsub" class="btn btn-success">提交博客</button>
                                <button type="reset" class="btn btn-warning">重置</button>
                            </div>
                        </div>
                    </form>

                </div>

            </div><!-- row end -->
        </div><!-- container end -->
    </section>



{% endblock %}

{% block scripts %}
    <!-- 配置文件 -->
    <script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="/ueditor/ueditor.all.js"></script>
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var ue = UE.getEditor('ueditor',{
            serverUrl:"/upload/"
        });
    </script>
{#    <script>#}
{##}
{#        var ue = UE.getContent();#}
{#        ue.ready(function () {#}
{#            var html = ue.getContent();#}
{#            Ue.ajax.request('/blog/post/', {#}
{#                method: 'POST',#}
{#                timeout: 10000,#}
{#                async: true,#}
{#                data: {#}
{#                    body: html#}
{#                },#}
{#                onsuccess: function (xhr) {#}
{#                    console.log(xhr.responseText);#}
{#                },#}
{#                onerror: function (xhr) {#}
{#                    alert('Ajax请求失败');#}
{#                }#}
{#            });#}
{#        });#}
{##}
{#    </script>#}
{% endblock %}